package com.zb.system.controller;


import com.zb.result.PageUtil;
import com.zb.result.Result;
import com.zb.service.ZjSmsSendLogService;
import com.zb.utils.TokenUtil;
import com.zb.vo.SendSmsCountListSearchVo;
import com.zb.vo.SmsSendLogListSearchVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 商家短信发送记录表 前端控制器
 * </p>
 *
 * @author WEN
 * @since 2024-03-23
 */
@Api(tags = "短信发送记录类接口")
@RestController
@RequestMapping("/system/sms/send/log")
public class ZjSmsSendLogController {
    @Resource
    private ZjSmsSendLogService smsSendLogService;

    @ApiOperation("获取短信发送记录列表")
    @PostMapping("/getList")
    public Result getList(HttpServletRequest request, @RequestBody SmsSendLogListSearchVo searchVo) {
        Long custAccId = TokenUtil.getcustAccIdByToken(request);
        return Result.success("获取短信发送记录列表成功").data(smsSendLogService.getList(custAccId, searchVo));
    }

    @ApiOperation("根据短信ID获取发送短信详情")
    @GetMapping("/getDetail/{id}")
    public Result getDetail(@PathVariable @ApiParam(value = "短信ID", required = true) Long id) {
        return Result.success("获取发送短信详情").data(PageUtil.row(smsSendLogService.getDetail(id)));
    }


    @ApiOperation("获取短信发送数量列表")
    @PostMapping("/getSendSmsCountList")
    public Result getSendSmsCountList(HttpServletRequest request, @RequestBody SendSmsCountListSearchVo searchVo) {
        Long custAccId = TokenUtil.getcustAccIdByToken(request);
        return Result.success("获取短信发送数量列表成功").data(smsSendLogService.getSendSmsCountList(custAccId, searchVo));
    }

}
